package com.example.knowledge.fragement;

import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.baselib.base.BaseMVPFragment;
import com.example.baselib.mvp.IPresenter;
import com.example.knowledge.adapter.CourseCatalogueAdapter;
import com.example.knowledge.bean.CourseCatalogueBean;
import com.example.news.R;

import java.util.ArrayList;
import java.util.List;

/**
 * 课程目录
 */
public class CourseCatalogueFragment extends BaseMVPFragment {
    private RecyclerView recycleview;
    private List<CourseCatalogueBean> courseCatalogueBeanList = new ArrayList<>();
    private CourseCatalogueAdapter courseCatalogueAdapter;

    @Override
    protected IPresenter createPresenter() {
        return null;
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.fragment_course_catalogue;
    }

    @Override
    protected void initView(View rootView) {
        recycleview = rootView.findViewById(R.id.recycleview);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext,
                LinearLayoutManager.VERTICAL, false);
        recycleview.setLayoutManager(linearLayoutManager);
        courseCatalogueAdapter = new CourseCatalogueAdapter(R.layout.item_course_catalogue_recycleview, courseCatalogueBeanList);
        courseCatalogueAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);
        recycleview.setAdapter(courseCatalogueAdapter);
    }

    @Override
    protected void initData() {
        courseCatalogueBeanList.add(new CourseCatalogueBean("01", "吃中药要不要忌口？", 0));
        courseCatalogueBeanList.add(new CourseCatalogueBean("02", "中药的归经问题解答 ", 0));
        courseCatalogueBeanList.add(new CourseCatalogueBean("03", "中药常见方剂问题与注意事项 ", 0));
        courseCatalogueBeanList.add(new CourseCatalogueBean("04", "吃中药要不要忌口？", 1));
        courseCatalogueBeanList.add(new CourseCatalogueBean("05", "吃中药要不要忌口？", 1));
        courseCatalogueBeanList.add(new CourseCatalogueBean("06", "吃中药要不要忌口？", 1));
        courseCatalogueBeanList.add(new CourseCatalogueBean("07", "吃中药要不要忌口？", 1));
        courseCatalogueBeanList.add(new CourseCatalogueBean("08", "吃中药要不要忌口？", 1));
        courseCatalogueBeanList.add(new CourseCatalogueBean("09", "吃中药要不要忌口？", 1));
        courseCatalogueAdapter.setNewData(courseCatalogueBeanList);
        courseCatalogueAdapter.notifyDataSetChanged();

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }
}
